package com.ryan.spring.annotation.model;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.annotation.Profile;
import org.springframework.lang.Nullable;

/**
 * Created by kaimin on 28/1/2019.
 * time : 09:24
 * FactoryBean 工厂bean，也能把bean注入到工厂里面
 */

public class CarFactoryBean implements FactoryBean<Car>{
    @Nullable
    public Car getObject() throws Exception {
        System.out.println("Car created by CarFactoryBean");
        return new Car();
    }

    @Nullable
    public Class<?> getObjectType() {
        return Car.class;
    }
}
